#!/usr/bin python
# -*- coding: utf-8 -*-
"""位置信息api接口"""
import json
from flask import jsonify, request, make_response
from flask import Blueprint

position_bp = Blueprint("position", __name__, url_prefix="/position")


# 位置上报
@position_bp.route("/report", methods=["POST"])
def api_report_position_data():
    request_data = request.json
    lat = request_data.get("lat", None)
    lng = request_data.get("lng", None)
    print(lat, lng)
    response = make_response(jsonify(True))
    return response


# 任务位置下发
@position_bp.route("/send", methods=["GET"])
def api_send_position_data():
    position_point = {}
    lat = "112"
    lng = "113"
    position_point["lat"] = lat
    position_point["lng"] = lng
    print(position_point)
    data = json.dumps(position_point)
    return data
